package gui;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import ttt.*;

public class Field extends JLabel {
	
	private int mark;
	
	public Field() {
		setText(intToStr(TicTacToe.EMPTY_MARK));
		setPreferredSize(new Dimension(30, 30));
		setBorder(new LineBorder(Color.BLACK));
		setHorizontalAlignment(SwingConstants.CENTER);
	}
	
	public int getMark() {
		return mark;
	}
	
	public void setMark(int i) {
		mark = i;
		setText(intToStr(i));
	}
	
	public String intToStr(int i) {
		String marks = "O X";
		return "" + marks.charAt(i + 1);
	}
}
